package com.hmy.cornpestdet.service;

import com.hmy.cornpestdet.mapper.UserDataAnalyzeMapper;
import com.hmy.cornpestdet.mapper.UserImageUploadInfoMapper;
import com.hmy.cornpestdet.utils.CPDConst;
import com.hmy.cornpestdet.utils.Result;
import com.hmy.cornpestdet.vo.ImageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserImageUploadInfoService {
    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    @Autowired
    UserImageUploadInfoMapper userImageUploadInfoMapper;

    public Result getUserImageUploadInfoByUid() {
        //获取当前的uid
        String uidStr = redisTemplate.opsForValue().get(CPDConst.CURRENT_USER_UID);
        if(uidStr == null){
            return Result.Error("当前Uid为空");
        }
        int uid = Integer.valueOf(uidStr);
        List<ImageVo>list = userImageUploadInfoMapper.getUserImageUploadInfoByUid(uid);
        return Result.Success("获取成功",list);
    }

}
